from django.db import models

# Create your models here.
############  员工薪资系统 ##########
# #部门表
class BuMen(models.Model):
    title=models.CharField(verbose_name='部门',max_length=16)
    # 相对于把对象的值获取出来   __str__
    def __str__(self):
        return self.title

#员工薪资表
class UserTypes(models.Model):
    name=models.CharField(verbose_name='名字',max_length=32)
    modlie=models.CharField(verbose_name='手机号',max_length=11)
    age=models.IntegerField(verbose_name='年龄')
    sex_choies=(
        (1,'男'),
        (2,'女')
    )
    sex=models.SmallIntegerField(verbose_name='性别',choices=sex_choies)
    shenfen=models.CharField(verbose_name='身份证',max_length=64)
    account_s=models.DecimalField(verbose_name='薪资',max_digits=10,decimal_places=2,default=0)
    deant=models.ForeignKey(to="BuMen",to_field='id',on_delete=models.CASCADE,verbose_name='部门',default=0)
    Detime=models.DateField(verbose_name='入职时间',null=True,blank=True)
    Retime=models.DateField(verbose_name='离职时间',null=True,blank=True)

class Admins(models.Model):
    # 管理员表
    img=models.FileField( verbose_name='头像',max_length=128,upload_to='admins/')
    user_n=models.CharField(verbose_name='用户名',max_length=32)
    password=models.CharField(verbose_name='密码',max_length=64)

    # 将需要的数据返回给页面
    def __str__(self):
        return self.user_n

# class Task(models.Model):
#     # 任务
#     level_choices=(
#         (1,'重要'),
#         (2,'紧急'),
#         (3,'严重')
#     )
#     level=models.SmallIntegerField(verbose_name='级别',choices=level_choices,default=1)
#     title=models.CharField(verbose_name='标题',max_length=64)
#     detail=models.TextField(verbose_name='详细信息',max_length=64)
#     # user=models.ForeignKey(verbose_name='负责人',to='Admins',on_delete=models.CASCADE)

class QingJia(models.Model):
    # oid=models.IntegerField(verbose_name='请假单号',default=200000003333333)
    user=models.CharField(verbose_name='姓名',max_length=32)
    sex_choices=(
        (1,'男'),
        (2,'女')
    )
    sex=models.SmallIntegerField(verbose_name='性别',choices=sex_choices,default=1)
    age=models.IntegerField(verbose_name='年龄')
    deart=models.ForeignKey(verbose_name='部门',to='BuMen',on_delete=models.CASCADE)
    test=models.TextField(verbose_name='请假内容', max_length=128)
    times=models.DateField(verbose_name='请假时间')
    retime=models.DateField(verbose_name='销假时间', null=True, blank=True )
    level_choices = (
        (1, '已请假'),
        (2, '未销假'),
        (3, '已销假')
    )
    level = models.SmallIntegerField(verbose_name='请假状态', choices=level_choices, default=1)
    admins=models.ForeignKey(verbose_name='审核员',to=Admins,on_delete=models.CASCADE)

#旅游表
class Travel(models.Model):
    name=models.CharField(verbose_name='名字',max_length=64)
    user=models.CharField(verbose_name='旅游地点',max_length=32)
    count=models.IntegerField(verbose_name='人数')
    img=models.FileField(verbose_name='图片',max_length=128,upload_to='city/')


